function findHero() {
    var promises = [];
    
    
    var url = gamePlatUrl;
    $.get(url, function(data, status){
        
        var len = data.length;
        for(var i = 0; i < len; i++) {
            
            var id = JSON.parse(data[i].body).id;

            var userUrl = "https://api.github.com/gists/" + id + "/comments";

            var promise = new Promise(function(resolve, reject) {
                $.get(userUrl, function(data, status) {
                    var len = data.length;
                    
                    var item = data[len - 1].body;

                    var scoreMax = JSON.parse(item).score;
                    var timeMin = JSON.parse(item).time;
                    var user = JSON.parse(item).user;

                    var result = {};

                    result.user = user;
                    result.score = scoreMax;
                    result.time = timeMin;

                    resolve(result);
                });
            });

            promises.push(promise);
        }

        Promise.all(promises).then(function(values){
            var len = values.length;
            var hero = "";
            var maxScore = 0;
            var minTime = 0;

            console.log(values);

            for(var i = 0; i < len; i++) {
                var score = values[i].score;

                if(score >= maxScore) {
                    maxScore = score;
                    hero = values[i].user;
                    minTime = values[i].time;
                }
            }

            $("#hero-score").html(maxScore);
            $("#hero-time").html((Number(minTime)/60).toFixed(2));
            $("#hero-name").html(hero);
        });
    });
}
